var MongoClient = require('mongodb').MongoClient;
var _globaldb;
module.exports = {
    init: function (url, callback) {
        var self = this;
        MongoClient.connect(url, { poolSize: 10 }, function (err, db) {
            if (err) {
                callback && callback(err)
                return;
            }
            _globaldb = db;
            callback();
        });

    },
    get: function (collection) {
        return _globaldb.collection(collection);
    }

}